﻿/**
  KCAKCAK   CAKCAKC   AK      CA
 AK        KC     CA  AK    AK
CA         KC     CA  AK  KC
CA         KCAKCAKCA  AKCA
CA         KC     CA  AK  KC
 AK        KC     CA  AK    AK
  KCAKCAK  KC     CA  AK      CA

_________________________________________________________________
 China ataca Kamchatka - copyright 2007(c) Ruben Sainz de la Maza
 
	@class: 	Rounds
	@vertion: 	0.1
	@date:		28/11/07
				
	@language: 	ActionScript 3.0
	@author:	Ruben Sainz de la Maza
	@usage: 
		_objRounds = new Rounds();
		_objRounds.init();
		//verificar el funcionamiento
		trace("Crear jugador: "+_objRounds.createRound("Ruben", "AZUL"));
		trace("Crear jugador: "+_objRounds.createRound("Ruben", "NEGRO")); 
		
**/

package com.conelmate.cak.game.rounds
{
	
	import com.conelmate.util.Trace;
	
	
	public class Rounds extends Trace implements IRound
	{
		
		private var _objRounds		:Object;			//almacena los objetos Rounds creados
		
		private var	_isFreeze		:Boolean = false;	//true:congela eventos, false:reactiva eventos


//_________________________________________________________________________________ Constructor
		public function Rounds()
		{
			_isTrace = true;
			mTrace("#Rounds# constructor");
			
		}
		

//_________________________________________________________________________________ Public Methods

		/**
		 * Inicializa la clase
		 */
		public function init():void
		{
			mTrace("#Rounds# init");
			
			_objRounds = new Object();
		}
		

		/**
		 * Destruye las instancias
		 */
		public function destroy():void
		{
			mTrace("#Rounds# destroy");
		}
		
		
		/**
		 * Congela / descongela los eventos de la clase
		 * @param   freeze 
		 */		
		public function freeze(freeze:Boolean):void
		{
			mTrace("#Rounds# freeze");
			_isFreeze = freeze;
		}
		

		/**
		 * Crear una nueva ronda
		 */		
		public function createRound(pName:String):Boolean
		{
			if(_objRounds[pName]) return false;
			else {
				var objRound:Round = new Round(pName);
				_objRounds[pName] = objRound;
				
				//verificar:
				mTrace(_objRounds[pName].pName);
				
				return true;
			}
		}
		
		
		/**
		 * Eliminar una ronda
		 * @param   pName:Nombre de la ronda
		 */		
		public function destroyRound(pName:String):Boolean
		{
			if(_objRounds[pName]){
				_objRounds[pName].destroy();
				_objRounds[pName] = null;
				return true;
			} else return false;
		}


//_________________________________________________________________________________ Private Methods
//_________________________________________________________________________________ GETTERS
//_________________________________________________________________________________ SETTERS

	}
}